<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
    <title>Intro to ImageryLayer - 4.6</title>

    <link rel="stylesheet" href="https://js.arcgis.com/4.6/esri/css/main.css">
    <script src="https://js.arcgis.com/4.6/"></script>

    <style>
        html,
        body,
        #viewDiv {
            padding: 0;
            margin: 0;
            height: 100%;
            width: 100%;
        }
    </style>

    <script>
        require([
            "esri/Map",
            "esri/views/MapView",
            "esri/layers/ImageryLayer",
            "dojo/domReady!"
        ],
            function (
                Map, MapView,
                ImageryLayer
            ) {

                /********************
                 * Create image layer
                 ********************/

                var layer = new ImageryLayer({
                    url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/NLCDLandCover2001/ImageServer",
                    format: "jpgpng" // server exports in either jpg or png format
                });

                /**************************
                 * Add image layer to map
                 *************************/

                var map = new Map({
                    basemap: "gray",
                    layers: [layer]
                });

                var view = new MapView({
                    container: "viewDiv",
                    map: map,
                    center: [-100, 40],
                    zoom: 5
                });
            });
    </script>
</head>

<body>
    <div id="viewDiv"></div>
</body>

</html>